---
title: "Example: Reranking with Cohere | RAG | Kastrax Docs"
description: Example of using Kastrax to improve document retrieval relevance with Cohere's reranking service.
---

# Reranking with Cohere ✅

When retrieving documents for RAG, initial vector similarity search may miss important semantic matches. 

Cohere's reranking service helps improve result relevance by reordering documents using multiple scoring factors.

```typescript 
import { rerank } from "@kastrax/rag";

const results = rerank(
  searchResults,
  "deployment configuration",
  cohere("rerank-v3.5"),
  {
    topK: 5,
    weights: {
      semantic: 0.4,
      vector: 0.4,
      position: 0.2
    }
  }
);
```

## Links ✅

- [rerank() reference](/reference/rag/rerank.mdx)
- [Retrieval docs](/reference/rag/retrieval.mdx)
